package fr.afcepf.atodcp2.benbai.dao.implementations;

import java.util.ArrayList;
import java.util.List;

import fr.afcepf.atodcp2.benbai.dao.generique.GenericDaoHibernateTemplateImpl;
import fr.afcepf.atodcp2.benbai.dao.interfaces.IDaoCommande;
import fr.afcepf.atodcp2.benbai.entity.Client;
import fr.afcepf.atodcp2.benbai.entity.Commande;

public class DaoCommande extends GenericDaoHibernateTemplateImpl<Commande, Integer>
		implements IDaoCommande {
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Commande> getCommandesByClient(Client client) {
		List<Commande> retour = new ArrayList<Commande>();
		String param = "paramIdClient";
		Object value = client.getIdClient();
		retour = hibernateTemplate.findByNamedParam("FROM Commande c WHERE c.client.idClient like :paramIdClient", param, value);		
		return retour;
	}

	

}
